/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Raytracing.Shaders;

import processing.core.PVector;

/**
 *
 * @author Matt
 */
public class CheckerTexture extends TextureProvider{

    private float gridResX = 25;
    private float gridResY = 25;
    
    PVector sheetColor = new PVector(.95f,.95f,.95f);
    PVector gridColor = new PVector(.1f,.1f,.1f);

    
    public CheckerTexture(float gridResX, float gridResY){
        this.gridResX = gridResX;
        this.gridResY = gridResY;
    }
    
    public void getColor(float u, float v, PVector ret) {
        if ((Math.floor(gridResX*u) + Math.floor(gridResY*v))%2 < 1)
        {
            ret.set(gridColor);
        }
     
        else{
            ret.set(sheetColor);
        }
    }
}
